<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.ajax4jsf.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
<body>                      
<ui:composition>

	<h:form id="weather_form">
		
		<h:panelGrid columns="1" id="weather_pg">
			<h:outputLabel for="city_input">Choose City :</h:outputLabel>
			<h:panelGroup>
				<s:validateAll>
					<h:inputText id="city_input" value="#{weather.location}" required="true" 
					requiredMessage="Location must be selected"
					 converter="weather">
					</h:inputText>
				</s:validateAll>
				<h:message styleClass="errors error" for="city_input" />
			</h:panelGroup>
		    <rich:suggestionbox for="city_input" suggestionAction="#{weather.autoComplete}" height="100"
		    	var="location" minChars="2">
		    	<h:column>
		    		<h:outputText value="#{location.name}#{weather.locationSeparator} #{location.parentLocation.name}"/>
		    	</h:column>
		    </rich:suggestionbox>
		    <h:outputLabel>Unit :</h:outputLabel>
			<h:panelGroup>
			  	<h:selectOneRadio value="#{weather.tempUnit}">
			  		   <s:convertEnum />
					   <s:enumItem enumValue="CELCIUS" label="Celcius" />
					   <s:enumItem enumValue="FAHRENHEIT" label="Fahrenheit" />
			  	</h:selectOneRadio>
		    </h:panelGroup>

		    <a4j:commandButton action="#{weather.addWeatherPlay}" value="Add"
		    	 reRender="weather_pg,selectList"/>
	    </h:panelGrid>
	
	</h:form>
                

</ui:composition>

</body>

</html>